<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>博客</title>
</head>

<body>

    <div>
        <input type="text" placeholder="请输入需要查找的id、标题、内容、摘要、分类、作者、发表时间 name="keyword ">
        <input type="button" value="查找" onclick="query()">
        <input type="button" value="添加" onclick="add()">
    </div>
<style>

</style>
    <table id="tbData">
        <tr>
            
            <th>
                Id
            </th>
            <th>
                标题
            </th>
            <th>
                摘要
            </th>
            <th>
                内容
            </th>
            <th>
                作者
            </th>
            <th>
                分类
            </th>
            <th>
                发表时间
            </th> 
            <th>
                操作
            </th>
        </tr>
    </table>


    <script src="./base.js"></script>
    <script src="./js/api.js"></script>
    <script src="./init.js"></script>
    <script src="./jquery-3.6.0.min.js"></script>
    <script>
        function update(id) {
            location.href = './addOrEdit.html?id=' + id;
        }
        function del(id) {
            delProductById(id).then(data => {
                if (data.code === 1000) {
                    console.log(data);
                    let id = data.data.id;
                    $(`[key=${id}]`).remove();
                } else {
                    alert(data.msg);
                }
            })
        }
        function query(){
            let keyword=$('[name=keyword]').val();
            getListWithKeyword(keyword);
        }
    </script>
</body>

</html>